﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



using System.Drawing;




namespace HAVTKPack
{
    [Serializable ]
     public  class ContourScalarBar
    {

        public ContourScalarBar()
        { 
        
        
        }




        bool _isShowScalarBar = true;
        /// <summary>
        /// 是否显示图例
        /// </summary>
        public bool IsShowScalarBar
        {
            get { return _isShowScalarBar; }
            set { _isShowScalarBar = value; }
        }

        bool _isDragable = true;
        /// <summary>
        /// 是否允许拖动
        /// </summary>
        public bool IsDragable
        {
            get { return _isDragable; }
            set { _isDragable = value; }
        }



        double _width = 0.04;
        //double _width = 5;
        /// <summary>
        /// 图例宽度  占视口比例 1为全部
        /// </summary>
        public double Width
        {
            get { return _width; }
            set
            {
                if (value  < 0)
                {
                    _width = 0.04;
                }
                else if (value > 1)
                {
                    _width = 1;
                }
                else
                {
                    _width = value;
                }

            }
        }


        double _height = 0.5;
        //double _height = 10;
        /// <summary>
        /// 图例高度  占视口比例 1为全部
        /// </summary>
        public double Height
        {
            get { return _height; }
            set {

                if (value < 0)
                {
                    _height = 0.04;
                }
                else if (value > 1)
                {
                    _height = 1;
                }
                else
                {
                    _height = value;
                }
            
            }
        }

        double _xLowLeftToViewPort = 0;
        /// <summary>
        ///  图例坐标   X  左下角偏移量  占视口比例 1为全部
        /// </summary>
        public double XLowLeftToViewPort
        {
            get { return this._xLowLeftToViewPort; }
            set {

                if (value < 0)
                {
                    _xLowLeftToViewPort = 0.04;
                }
                else if (value > 1)
                {
                    _xLowLeftToViewPort = 1;
                }
                else
                {
                    _xLowLeftToViewPort = value;
                }
                
               
            
            }
        }

        double _yLowLeftToViewPort = 0;
        /// <summary>
        /// 图例坐标   Y  左下角偏移量  占视口比例 1为全部
        /// </summary>
        public double YLowLeftToViewPort
        {
            get { return this._yLowLeftToViewPort; }
            set {


                if (value < 0)
                {
                    _yLowLeftToViewPort = 0.04;
                }
                else if (value > 1)
                {
                    _yLowLeftToViewPort = 1;
                }
                else
                {
                    _yLowLeftToViewPort = value;
                }             
            
            }
        }







        string _title = "DataSet";
        /// <summary>
        /// 图例标题
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }




        Color _titleColor = Color.Black;
        /// <summary>
        /// 图例标题颜色
        /// </summary>
        public Color TitleColor
        {
            get { return _titleColor; }
            set { _titleColor = value; }
        }



        int _titleFontSize = 10;
        /// <summary>
        /// 图例标题字体大小
        /// </summary>
        public int TitleFontSize
        {
            get { return _titleFontSize; }
            set { _titleFontSize = value; }
        }


        Color _labelColor = Color.Black;
        /// <summary>
        /// 图例文本颜色
        /// </summary>
        public Color LabelColor
        {
            get { return _labelColor; }
            set { _labelColor = value; }
        }

        int _labelFontSize = 10;
        /// <summary>
        /// 图例文本字体
        /// </summary>
        public int LabelFontSize
        {
            get { return _labelFontSize; }
            set { _labelFontSize = value; }
        }





        public void UpdateContourScalarBar(ContourScalarBar  contourScalarBar)
        {

            if (contourScalarBar != null)
            {


                if (this._isShowScalarBar != contourScalarBar._isShowScalarBar)
                {
                    this._isShowScalarBar = contourScalarBar._isShowScalarBar;
                }



                if (this._isDragable != contourScalarBar._isDragable)
                {
                    this._isDragable = contourScalarBar._isDragable;
                }




                if (this._width !=contourScalarBar ._width )
                {
                    this._width = contourScalarBar._width;
                }
                if (this._height !=contourScalarBar ._height )
                {
                    this._height = contourScalarBar._height;
                }
                if (this._xLowLeftToViewPort !=contourScalarBar ._xLowLeftToViewPort )
                {
                    this._xLowLeftToViewPort = contourScalarBar._xLowLeftToViewPort;
                }
                if (this._yLowLeftToViewPort !=contourScalarBar ._yLowLeftToViewPort )
                {
                    this._yLowLeftToViewPort = contourScalarBar._yLowLeftToViewPort;
                }









                if (this._title != contourScalarBar._title)
                {
                    this._title = contourScalarBar._title;
                }


                if (this._titleColor != contourScalarBar._titleColor)
                {
                    this._titleColor = contourScalarBar._titleColor;
                }



                if (this._titleFontSize != contourScalarBar._titleFontSize)
                {
                    this._titleFontSize = contourScalarBar._titleFontSize;
                }


                if (_labelColor != contourScalarBar._labelColor)
                {
                    this._labelColor = contourScalarBar._labelColor;
                }

                if (this._labelFontSize != contourScalarBar._labelFontSize)
                {
                    this._labelFontSize = contourScalarBar._labelFontSize;
                }





            }

        }


     




    }
}
